import Vue from 'vue'
import VueRouter, { NavigationGuardNext, Route, RouteConfig } from 'vue-router'
import { PageBefore } from './PageBefore'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
    {
        path: '/Reload',
        name: 'Reload',
        component: () => import("app/views/app/Reload.vue")
    },
    {
        path: '/',
        name: 'Home',
        component: () => import("@/views/Home.vue")
    },
    {
        path: '/About',
        name: 'About',
        component: () => import("@/views/About.vue")
    },
    {
        path: '/KeypadSelect',
        name: 'KeypadSelect',
        component: () => import("@/views/KeypadSelect.vue")
    },
]

const router = new VueRouter({
    routes
})

let pageBefore = new PageBefore();

router.beforeEach((to: Route, from: Route, next: NavigationGuardNext) => {
    pageBefore.before(to, from, next);
});

export default router
